package fr.channel.client.activity;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.google.inject.Inject;

import fr.channel.client.ClientFactory;
import fr.channel.client.metier.SmChannel;
import fr.channel.client.place.ConnectionPlace;

public class MainActivityMapper implements ActivityMapper {

	private ClientFactory clientFactory;
	private SmChannel smChannel;

	@Inject
	public MainActivityMapper(final ClientFactory pClientFactory, final SmChannel pSmChannel) {
		super();
		this.clientFactory = pClientFactory;
		this.smChannel = pSmChannel;
	}

	@Override
	public final Activity getActivity(final Place place) {
		if (place instanceof ConnectionPlace) {
			return new ConnectionActivity(clientFactory, smChannel);
		}
		return null;
	}

}
